package com.lfb.homework;

import java.util.LinkedList;
import java.util.List;

public class HomeWork01 {
    public static void main(String[] args) {
        test01();
    }

    public static void test01(){
        MyQueue myQueue = new MyQueue();
        myQueue.put("a");
        myQueue.put("b");
        myQueue.put("c");
        System.out.println(myQueue.isEmpty());
        while(true){
            try {
                Object obj = myQueue.get();
                System.out.print(obj + "  ");
            } catch (Exception e) {
                break;
            } finally {
            }
        }
    }
}
class MyQueue{
    LinkedList<Object> linkedList = new LinkedList<>();

    public boolean isEmpty(){
        return linkedList.size()==0 ? true : false;
    }

    public void put(Object obj){
        linkedList.add(obj);
    }

    public Object get(){
        //获取队列中的第一个元素
        Object obj = linkedList.getFirst();
        //删除队列中的第一个元素
        linkedList.removeFirst();
        //返回obj
        return obj;
    }
}
